//
//  WelcomeVC.swift
//  WBSwift
//
//  Created by maker on 2016/11/14.
//  Copyright © 2016年 maker. All rights reserved.
//

import UIKit
import SDWebImage

class WelcomeVC: UIViewController {
    //MARK:==========属性==========
    @IBOutlet weak var iconImage: UIImageView!
    @IBOutlet weak var welcomeLbl: UILabel!
    @IBOutlet weak var iconBottom: NSLayoutConstraint!
    

    //MARK:==========声明周期==========
    override func viewDidLoad() {
        super.viewDidLoad()
        let url = UserInfoViewModel.shareInstance.user?.avatar_large
        let userName = UserInfoViewModel.shareInstance.user?.screen_name
    
        let URL = Foundation.URL(string: url ?? "")
        iconImage.sd_setImage(with: URL, placeholderImage: UIImage(named: "avatar_default_big"))
        welcomeLbl.text = userName
        self.iconBottom.constant = UIScreen.main.bounds.size.height - 200
        
        UIView.animate(withDuration: 3, delay: 0.01, usingSpringWithDamping: 0.3, initialSpringVelocity: 5, options: [], animations: { 
            self.iconImage.center.y = 150
            self.welcomeLbl.center.y = 205
        }) { (_) in
            
              UIApplication.shared.keyWindow?.rootViewController = UIStoryboard.init(name: "Main", bundle: nil).instantiateInitialViewController()
        }
        
    }
}
